(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./index'), require('moment')) :
    typeof define === 'function' && define.amd ? define(['./index', 'moment'], factory) :
    global.hdata = factory(auto, moment);
}(this, function (auto, moment) { 'use strict';

var Random = auto.Random;

const PAYMENT = ['通讯', '交通', '娱乐', '住房', '购物', '餐饮'];

const TEST_TEMPLATE = function(num) {
  var templet = {}
  templet['data|' + num] = [{
    "id|+1": 1,
    uuid: "@lower(@guid)",
    name: "@cname",
    content: "@csentence",
    uptime: "@datetime()"
  }]
  return templet;
}

return {
  test: auto(TEST_TEMPLATE(10)).data,
  testFun: function(num) {
    return auto(TEST_TEMPLATE(num || 10)).data;
  },

  business: auto({
    "errCode": 200,
    "message": '',
    "data|1-100": [{
      "date": '@datetime',
      "time": function() {
        return moment(this.date).valueOf()
      },
      "year": function() {
        return moment(this.date).year()
      },
      'month': function() {
        return moment(this.date).month()
      },
      "type|0-5": 1,
      "alias": function() {
        return PAYMENT[this.type]
      },
      "money|20-1000.2": 1
    }]
  })
}

}))